package com.ruoyi.ebike.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.ebike.mapper.BillingRulesMapper;
import com.ruoyi.ebike.domain.BillingRules;
import com.ruoyi.ebike.service.IBillingRulesService;

/**
 * 计费规则Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-01-02
 */
@Service
public class BillingRulesServiceImpl implements IBillingRulesService 
{
    @Autowired
    private BillingRulesMapper billingRulesMapper;

    /**
     * 查询计费规则
     * 
     * @param ruleId 计费规则主键
     * @return 计费规则
     */
    @Override
    public BillingRules selectBillingRulesByRuleId(Long ruleId)
    {
        return billingRulesMapper.selectBillingRulesByRuleId(ruleId);
    }

    /**
     * 查询计费规则列表
     * 
     * @param billingRules 计费规则
     * @return 计费规则
     */
    @Override
    public List<BillingRules> selectBillingRulesList(BillingRules billingRules)
    {
        return billingRulesMapper.selectBillingRulesList(billingRules);
    }

    /**
     * 新增计费规则
     * 
     * @param billingRules 计费规则
     * @return 结果
     */
    @Override
    public int insertBillingRules(BillingRules billingRules)
    {
        billingRules.setCreateTime(DateUtils.getNowDate());
        return billingRulesMapper.insertBillingRules(billingRules);
    }

    /**
     * 修改计费规则
     * 
     * @param billingRules 计费规则
     * @return 结果
     */
    @Override
    public int updateBillingRules(BillingRules billingRules)
    {
        billingRules.setUpdateTime(DateUtils.getNowDate());
        return billingRulesMapper.updateBillingRules(billingRules);
    }

    /**
     * 批量删除计费规则
     * 
     * @param ruleIds 需要删除的计费规则主键
     * @return 结果
     */
    @Override
    public int deleteBillingRulesByRuleIds(Long[] ruleIds)
    {
        return billingRulesMapper.deleteBillingRulesByRuleIds(ruleIds);
    }

    /**
     * 删除计费规则信息
     * 
     * @param ruleId 计费规则主键
     * @return 结果
     */
    @Override
    public int deleteBillingRulesByRuleId(Long ruleId)
    {
        return billingRulesMapper.deleteBillingRulesByRuleId(ruleId);
    }
}
